

package net.soporte.form;


import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 * Clase que : 
 *
 * Path = Pruebas--net.soporte.struts.helloworld.form.
 *
 * @author ri00642
 *
 */
public class LoginForm extends ActionForm {

	
	//private static final long serialVersionUID = 7330363940792996443L;
	private String userName;     
	private String password;   
	private String accion;

	
	public ActionErrors validate(ActionMapping mapping,             HttpServletRequest request) {
	ActionErrors actionErrors = new ActionErrors();          
	if(userName == null || userName.trim().equals("")) { 
		actionErrors.add("userName", new ActionMessage("error.username"));         
		}         
	try {         
		if(password == null || password.trim().equals("")) {  
			actionErrors.add("password", new ActionMessage("error.password"));         
			}         
		}catch(Exception e) {          
			e.printStackTrace();         
			}         
		return actionErrors ;     
		} 
	
	public String getUserName() {   
		return userName;    
		}   
	public void setUserName(String userName) {   
		this.userName = userName;     
		} 
	public String getPassword() {        
		return password;     
		}    
	public void setPassword(String password) {   
		this.password = password;     
		}

	/**
	 * Obtiene el valor de accion.
	 *
	 * @return Regresa el accion.
	 * 
	 * @see String
	 */
	public String getAccion() {
		return accion;
	}

	/**
	 * Fija el valor de accion.
	 *
	 * @param accion parametro a fijar al campo accion.
	 *
	 * @see String
	 */
	public void setAccion(String accion) {
		this.accion = accion;
	}

	
}


